/*******************************************************************************
 * Copyright (c) 2004, 2005 Jean-Michel Lemieux, Jeff McAffer and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Hyperbola is an RCP application developed for the book
 *     Eclipse Rich Client Platform -
 *         Designing, Coding, and Packaging Java Applications
 *         (http://eclipsercp.org)
 * Contributors:
 *     Jean-Michel Lemieux and Jeff McAffer - initial implementation
 *******************************************************************************/
package org.reliablesource.prism.product.workbench;

import org.eclipse.jface.action.ICoolBarManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

/**
 * Configures the action bars for the non-rectangular window layout. 
 */
public class PrismNonRectActionBarAdvisor extends ActionBarAdvisor {

    private IWorkbenchAction deleteAction, copyAction;
    
    public PrismNonRectActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(IWorkbenchWindow window) {
        deleteAction = ActionFactory.DELETE.create(window);
        register(deleteAction);
        copyAction = ActionFactory.COPY.create(window);
        register(copyAction);
    }

    protected void fillCoolBar(ICoolBarManager coolBar) {
        ToolBarManager mainToolBar = new ToolBarManager(SWT.FLAT | SWT.BOTTOM);
        mainToolBar.add(deleteAction);
        mainToolBar.add(copyAction);
        coolBar.add(mainToolBar);
        coolBar.setLockLayout(true);
    }
}
